package org.example.yunshu.demos.service;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.example.yunshu.demos.mapper.MessageMapper;
import org.example.yunshu.demos.model.Message;
import org.example.yunshu.demos.model.SessionUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

@Data
@Slf4j
@Service
public class MessageService {
    @Autowired
    private MessageMapper messageMapper ;

    public Object getHistoryMessage(Integer sessionId) {
        List<Message> list = messageMapper.getHistoryMessage(sessionId);
//         翻转list
        Collections.reverse(list) ;
        return list ;
    }
}
